/*******************************************************************************
 * Copyright (c) 2014 lifeng (lifengsofts@gmail.com)
 * See the file licenses/license.txt for copying permission.
 ******************************************************************************/
package cn.woblog.android.httputils.callback.impl;

import android.os.Handler;
import android.os.Message;
import cn.woblog.android.httputils.callback.AbstractCallback;
import cn.woblog.android.httputils.callback.OnRequestProgressListener;

public abstract class FileCallback extends AbstractCallback<String> implements
		OnRequestProgressListener {
	private Handler handler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			onProgress(msg.arg1, mContentLengt);
		};
	};
	private Message message;
	private int mContentLengt;

	@Override
	protected String bindData(String string) {
		return string;
	}

	// @Override
	// protected String save2File(InputStream content, int contentLengt)
	// throws IOException {
	// byte[] bf = new byte[2048];
	// int len = 0;
	// int currentPos = 0;
	// FileOutputStream fileOutputStream = new FileOutputStream(path);
	// mContentLengt = contentLengt;
	// while ((len = content.read(bf)) != -1) {
	// if (isShowProgress) {
	// currentPos += len;
	// message = Message.obtain();
	// message.arg1 = currentPos;
	// handler.sendMessage(message);
	// }
	// fileOutputStream.write(bf, 0, len);
	// }
	// fileOutputStream.close();
	// return path;
	// }

	// public void setProgress() {
	// isShowProgress = true;
	// }
}
